import request from "@/utils/request";

/**
 * 获取分类
 */
export const getCategory = () => {
  return request({
    url: "/mall/tenant/merchant/pricing/getPricingCategoryList",
    method: "get"
  });
};

/**
 * 获取草稿列表
 */
export const getDraftList = () => {
  return request({
    url: "/mall/tenant/merchant/pricing/getTempPricing",
    method: "get"
  });
};

/**
 * 获取调价记录
 */
export const getRecord = () => {
  return request({
    url: "/mall/tenant/merchant/pricing/getPricingSnapshotList",
    method: "get"
  });
};

/**
 * 保存草稿
 */
export const saveDraft = data => {
  return request({
    url: "/mall/tenant/merchant/pricing/saveTempPricing",
    method: "post",
    data
  });
};

/**
 * 单个普通毛利率查询
 */
export const getOrdinaryGrossMargin = data => {
  return request({
    url: "/mall/tenant/merchant/pricing/group-gross-margin",
    method: "post",
    data
  });
};

/**
 * 提交草稿
 */
export const submitDraft = data => {
  return request({
    url: "/mall/tenant/merchant/pricing/submit-pricing-draft",
    method: "post",
    data
  });
};

/**
 * 获取筛选属性列表
 */
export const getFilterAttr = data => {
  return request({
    url: "/mall/shopHome/queryStastsList",
    method: "post",
    data
  });
};

/**
 * 单个特殊毛利率
 */
export const getSpecialGrossMargin = data => {
  return request({
    url: "/mall/tenant/merchant/pricing/special-group-gross-margin",
    method: "post",
    data
  });
};

/**
 * 整个列表毛利率
 */
export const getAllGrossMargin = data => {
  return request({
    url: "/mall/tenant/merchant/pricing/draft-gross-margin",
    method: "post",
    data
  });
};

/**
 * 获取定价配置
 */
export const getPricingConfig = categoryId => {
  return request({
    url: `/mall/tenant/merchant/pricing/getPricingConfig/${categoryId}`,
    method: "get"
  });
};

/**
 * 详情
 */
export const getDetail = snapshotId => {
  return request({
    url: `/mall/tenant/merchant/pricing/snapshotDetails/${snapshotId}`,
    method: "get"
  });
};

/**
 * 商品定价-保存定制系数
 */
export const saveShopCoefficient = data => {
  return request({
    url: "/mall/tenant/merchant/pricing/saveShopCoefficient",
    method: "post",
    data
  });
};
